package com.xysd.express.activity.logistics;

import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

import com.xysd.express.R;
import com.xysd.express.base.BaseActivity;
import com.xysd.express.eventbus.LogisticsReceiveInfoEvent;
import com.xysd.express.rx.RxBus;
import com.xysd.express.util.ActivityTaskManeger;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

@ContentView(R.layout.activity_shipments)
public class ReceivingActivity extends BaseActivity implements View.OnClickListener {


    @ViewInject(R.id.adds_et)
    private EditText adds_et;
    @ViewInject(R.id.adds_clear_img)
    private ImageView adds_clear_img;
    @ViewInject(R.id.details_adds_et)
    private EditText details_adds_et;
    @ViewInject(R.id.name_et)
    private EditText name_et;
    @ViewInject(R.id.tel_et)
    private EditText tel_et;
    @ViewInject(R.id.affirm_btn)
    private Button affirm_btn;

    private String adds,adds_details,name,tel;

    @Override
    protected void init() {
        setTitleBar("收货信息");
        right_tv.setText("地图选址");
        adds_clear_img.setOnClickListener(this);
        affirm_btn.setOnClickListener(this);
        right_tv.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.adds_clear_img:
                adds_et.setText("");
                break;
            case R.id.affirm_btn:
                adds=adds_et.getText().toString();
                adds_details=details_adds_et.getText().toString();
                name=name_et.getText().toString();
                tel=tel_et.getText().toString();
                RxBus.getInstance().post(new LogisticsReceiveInfoEvent(adds,adds_details,name,tel));
                ActivityTaskManeger.getInstance().closeActivity(mActivity);
                break;
            case R.id.right_tv:
                MapActivity.start(mActivity,"receive");
                break;
        }

    }
}
